//
//  MYGCaseFilesApi.swift
//  MYGrow
//
//  Created by 小火科技 on 2024/4/9.
//

import UIKit
import Moya

enum MYGCaseFilesApi {
    case getClassClamp(patient_id:String, serche: String = "")
    case getClassClampInfo(id:Int)
    case addCaseFile(patient_id:String,hospital:String,visit_time:String,outpatient:String,inspection:String,medication:String,operation:String,examination:String,id:String? = "")
    case subjecTList
}

extension MYGCaseFilesApi:MYGTargetType {
    
    var path: String {
        switch self {
        case .getClassClamp:
            "/api/patient/get_case_clamp"
        case .getClassClampInfo:
            "/api/patient/get_case_clamp_info"
        case .addCaseFile:
            "/api/patient/set_case_clamp"
        case .subjecTList:
            "/api/department/subject_all_list"
        }
    }
    var params: [String : Any] {
        var params: [String: Any] = [:]
        switch self {
        case let .getClassClamp(patient_id,serche):
            params["patient_id"] = patient_id
            params["serche"] = serche
        case let .getClassClampInfo(id):
            params["id"] = id
        case let .addCaseFile(patient_id, hospital, visit_time, outpatient, inspection, medication, operation, examination, id):
            params["patient_id"] = patient_id
            params["hospital"] = hospital
            params["visit_time"] = visit_time
            params["outpatient"] = outpatient
            params["inspection"] = inspection
            params["medication"] = medication
            params["operation"] = operation
            params["examination"] = examination
            params["id"] = id
        case .subjecTList:
            break
        }
        return params
    }
    
    var method: Moya.Method {
        switch self {
        case .getClassClamp:
            .post
        case .getClassClampInfo:
            .get
        case .addCaseFile:
            .post
        case .subjecTList:
                .get
        }
    }

    
}
